package yunjiao.javatutorials.apache.kafka;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 *
 * 消息消费
 *
 * @author yangyunjiao
 */
@Component
public class KafkaConsumer {
    @KafkaListener(topics = "audit", groupId = "audit-group")
    public void audit(String message) {
        System.out.println("消费者接收[Audit]消息：" + message);
        // 业务处理...
    }

    @KafkaListener(topics = "logs", groupId = "logs-group")
    public void logs(String message) {
        System.out.println("消费者接收[Logs]消息：" + message);
        // 业务处理...
    }
}
